﻿//04.Write a program that compares two text files line by line and prints the number of lines that are the same and the number of lines that are different. Assume the files have equal number of lines.

using System;
using System.IO;

namespace CompareFiles
{
    class CompareFiles
    {
        static void Main()
        {
            using (StreamReader readerOne = new StreamReader("file1.txt"), readerTwo = new StreamReader("file2.txt"))
            {
                string lineFirstFile, lineSecondFile;
                int differentLines = 0, equalLines = 0;

                while ((lineFirstFile = readerOne.ReadLine()) != null && (lineSecondFile = readerTwo.ReadLine()) != null)
                {
                    if (lineFirstFile == lineSecondFile) equalLines++;
                    else differentLines++;
                }

                Console.WriteLine("{0} different lines , {1} equal lines out of {2} lines.", differentLines, equalLines,
                    (differentLines + equalLines));
            }
        }
    }
}
